<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>{:session('cp.cpsysname')}--商户管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>一什智慧城后台管理系统</title>

    <link href="__STATIC_URL__/static/css/style.css" rel="stylesheet">
    <link href="__STATIC_URL__/static/css/style-responsive.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/login.css">
    <script>
        function myBrowser(){
            var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
            var isOpera = userAgent.indexOf("Opera") > -1;
            if (isOpera) {
                return "Opera"
            }; //判断是否Opera浏览器
            if (userAgent.indexOf("Firefox") > -1) {
                return "FF";
            } //判断是否Firefox浏览器
            if (userAgent.indexOf("Chrome") > -1){
                return "Chrome";
            }
            if (userAgent.indexOf("Safari") > -1) {
                return "Safari";
            } //判断是否Safari浏览器
            if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
                return "IE";
            }; //判断是否IE浏览器
        }
        var neihe = myBrowser();
        if(neihe!="Chrome" && neihe != "Safari"){
            if(neihe!="Chrome" && neihe != "Safari" && neihe!="FF"){
                document.execCommand("Stop")
            }else{
                window.stop();
            }
            var t = confirm("请使用谷歌/Safari浏览器访问该网站！！！");
            if(t==true){
                window.location.href="http://www.chromeliulanqi.com";
            }
        }
    </script>
</head>

<body class="login-body" >
<form method="post" id="frm">
    <div style="display:table; height:100%;width:100%;">
        <div style="display:table-cell; vertical-align:middle; text-align:center;">
            <div class="login-form">
                <div id="admintype" class="text-center">商户登陆</div>
                <input type="text" style="display: none;">
                <input type="password" style="display: none;">
                <!--<div class="login-tab login-tab-l">-->
                    <!--<a href="javascript:void(0)" class="">扫码登录</a>-->
                <!--</div>-->
                <!--<div class="login-tab login-tab-r" style="width:345px;">-->
                    <!--<a href="javascript:void(0)" class="">账户登录</a>-->
                <!--</div>-->

                <div class="qrcode-login" style="display: none;">

                    <div class="qr-wrapper">
                    </div>
                    <p class="r-message">请使用微信扫描二维码登录</p>
                    <div>
                        <input type="text" id="txtCode" placeholder="输入验证码"><input onclick="login()" type="button" id="btnSubmit" style="margin-top: -5px;height: 32px;" placeholder="输入收到的二维码" value="登录">
                    </div>
                    <div style="width: 230px; margin: 10px auto 10px; line-height:30px; overflow:hidden;">
                        <span style="color:#000;font-size:16px; float:left;">还没有注册?</span>
                        <a href="" style="color:#FF0000; text-decoration:none; float:right;">立即注册</a>
                    </div>
                </div>
                <div class="login-box" style="display: block;">
                    <div class="form-group">
                        <input type="text" name="username" class="form-control" placeholder="账号" autofocus value="{$Think.cookie.username}" id="username">
                    </div>
                    <div class="form-group">
                        <input type="password" name='password' value="{$Think.cookie.password}" class="form-control" placeholder="密码">
                    </div>
                    <div class="form-group" style="position:relative;">
                    <input type='text' class='form-control' name='code' id="code" style='width:150px;' placeholder="清输入验证码">
                    <img src="{:captcha_src()}" alt="captcha" id="verify_img" width='100' class="img-responsive" style='float:right;position: absolute;top: 0;right: 0px;' onclick="refreshVerify()" />
                    </div>
                    <div class="form-group">
                        <input id="submit" type="button" class="btn btn-primary btn-block" onclick="check()" value="登录">
                    </div>
                    <div class="msg">

                    </div>
                </div>
            </div>
            <div id="js-login_fix" style="display:none;">
                <div>
                    <a href="/pages/login.aspx">收银员手机号登录(旧)</a>
                </div>
                <div>
                    <a href="/merchantClient/view/login">收银员账号登录</a>
                </div>
            </div>
        </div>
    </div>
</form>
<script src="__STATIC_URL__/static/js/jquery-1.10.2.min.js"></script>
<script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="__STATIC_URL__/static/js/modernizr.min.js"></script>
<script src="__STATIC_URL__/static/js/qrcode/qrcode.js"></script>
<script src="__STATIC_URL__/static/layer/layer.js"></script>
<script type="text/javascript">
    <!--回车键事件-->
    document.onkeydown = function (e) {
        var theEvent = window.event || e;
        var code = theEvent.keyCode || theEvent.which;
        if (code == 13) {
            check();
        }
    }
//    登录函数
    function check() {
        $.ajax({
            type: "POST",
            url: "{:url('Login/login')}",

            cache: false,
            data: $('#frm').serialize(),

            success: function (data) {

                refreshVerify();
                $("#code").val('');
                if(data.code==0){
                    layer.msg(data.message);
                    setTimeout(tz(data.url), 1000);
                }else if(data.code==4){
                   alert(data.message);
                    return false;
                }
                else{
                    alert(data.message);
                    return false;
                }
            }

        });
    }
//    刷新验证码函数
    function refreshVerify() {
        var ts = Date.parse(new Date()) / 1000;
        $('#verify_img').attr("src", "/captcha?id=" + ts);
    };
//提交数据页面跳转
    function tz(url) {
        window.location.href =url;
    }
    //tab 内容切换
    $('.login-tab').on('click', function() {
        $('.login-tab a').removeClass("checked");
        $(this).find('a').addClass("checked");
        if(this.className.indexOf('login-tab-r') !== -1) {
            $(".login-box").show();
            $(".qrcode-login").hide();
        } else {
            $(".login-box").hide();
            $(".qrcode-login").show();
        }
    });
    if(window.navigator.userAgent.indexOf('vcaimao') !== -1) {
        $(".side").show();
    }
</script>
<script type="text/javascript">
    // var c = "MozWebSocket" in window ? 'MozWebSocket' : ("WebSocket" in window ? 'WebSocket' : null);
    // function connectT(code) {
    //     host2=document.domain+":10223";
    //     wss = new WebSocket("wss://"+host2);
    //     wss.onopen = function() {
    //         wss.send(code);
    //     };
    //     wss.onmessage = function(e) {
    //   var data= eval('(' + e.data + ')');;
    //
    //
    //         if(data.code==0){
    //             window.location.href=data.url;
    //         }
    //     };
    // }
    // function GetQr() {
    //     try {
    //         $.ajax({
    //             type: "POST",
    //             url: "{:url('login/getqrlogin')}",
    //             dataType: "json",
    //             success: function(res) {
    //
    //                 if(res.errocde) {
    //                     alert(res.errmsg);
    //                 } else {
    //                     $(".qr-wrapper img").hide();
    //                     new QRCode($(".qr-wrapper")[0], {
    //                         text: res.login_url,
    //                         width: 200,
    //                         height: 200,
    //                         colorDark: '#000000',
    //                         colorLight: '#ffffff',
    //                         correctLevel: QRCode.CorrectLevel.L
    //                     });
    //                     connectT(res.shuju);
    //                 }
    //             }
    //         });
    //     } catch(ex) {
    //         alert(ex);
    //     }
    // }

</script>
</body>
</html>
